let HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  //入口
  entry: "./src/index.ts",
  //出口
  output: {
    path: __dirname + "/build",
    filename: "js/bundle.js",
    clean: true,
  },
  //模式
  mode: "development",
  //配置 loader
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: "ts-loader",
      },
    ],
  },
  //配置文件后缀
  resolve: {
    extensions: [".ts", ".tsx", ".js"],
  },
  //
  plugins: [
    new HtmlWebpackPlugin({
      template: "./public/index.html",
    }),
  ],
  //开发服务
  devServer: {
    port: 3000,
    open: true,
  },
};
